package zzj.campus_book_sharing_platform.test;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;

@Tag(name = "附件服务")
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/file")
public class FileController {

    @Autowired
    IFileService fileService;

    @PostMapping(value = "/wordToPdf",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    @Operation(summary = "word转pdf")
    public void FileToPdf(@ModelAttribute MultipartFile file, HttpServletResponse response) {
        fileService.word2Pdf(file, response);
    }
}
